<include file="Base:header" /> 

<script type="text/javascript">
	$(document).ready(function() {
		$("div#mws-login .mws-login-back").mouseover(function(event) {
			$(this).find("a").animate({'left':0})
		}).mouseout(function(event) {
			$(this).find("a").animate({'left':70})
		});
	});
</script>

	<div id="mws-login">
    	<h1>Sign in</h1>
        <div class="mws-login-lock"><img src="__PUBLIC__/Admin/css/icons/24/locked-2.png" alt="" /></div>
    	<div id="mws-login-form">
        	<form class="mws-form" action="{:U('')}" method="post">
                <div class="mws-form-row">
                	<div class="mws-form-item large">
                    	<input type="text" id="shouji" name="tel" class="mws-login-username mws-textinput" placeholder="手机号码" />
                    </div>
                </div>
                <div class="mws-form-row">
                	<div class="mws-form-item large">
                    	<input name="password" type="password" class="mws-login-password mws-textinput" placeholder="密码" />
                    </div>
                </div>

                <div class="mws-form-row">
                    <div class="mws-form-item large">
                        <input name="repassword" type="password" class="mws-login-password mws-textinput" placeholder="确认密码" />
                    </div>
                </div>

                <div class="mws-form-row">
                    <div class="mws-form-item large">
                        <input style="width: 150px;float: left" name="phonecode" type="text"
                               class="mws-login-password mws-textinput" placeholder="60秒内有效" />



                        <input type="button" id="btn" value="免费获取" onclick="settime(this)" style="width:91px;
                        float: right;height: 90%;" class="ajax"/>


                        <div style="clear: both"></div>
                    </div>
                </div>




                <div class="mws-form-row">
                	<input type="submit" value="Login" class="mws-button green mws-login-button" />
                </div>
            </form>
        </div>
    </div>

</body>



<script>


    var countdown=60;
    function settime(obj) {
        if (countdown == 0) {
            obj.removeAttribute("disabled");
            obj.value="免费获取验证码";
            countdown = 60;
            return;
        } else {
            obj.setAttribute("disabled", true);
            obj.value="重新发送(" + countdown + ")";
            countdown--;
        }
        setTimeout(function() {
                    settime(obj) }
                ,1000)
    }


    $(".ajax").click(function(){
        var shouji=$("#shouji").val();
        if(shouji == ''){
            alert('请填写手机号码');
        }else{
            var reg = /^1[3|4|5|7|8][0-9]{9}$/; //验证规则
            var flag = reg.test(shouji); //true
            if(flag){
                $.ajax({
                    type : "POST",
                    url :"<?php echo U('Index/ajaxCheck'); ?>",
                    dataType: "json",
                    data : {shouji : shouji},
                    success : function(data)
                    {
                        if(data == 100){
                            alert('发送成功');
                        }
                        if(data.info == 1){
                            alert('系统繁忙，请稍后再试');
                        }
                    }
                })

            }else{
                alert('手机号码格式不正确');
            }
        }
    });

</script>

</html>
